{include file="common:meta" /}

<title>添加用户 - TXCMS_V2</title>
<meta name="keywords" content="">
<meta name="description" content="">
</head>
<body>
<article class="cl pd-20">
    <form action="" method="post" class="form form-horizontal form-agent-edittt">
        <input type="hidden" name="id" value="{$data.id}">
        <input type="hidden" name="aid" value="{$aid}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>昵称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$data.nickname}" placeholder="" id="nickname"
                       name="nickname">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>账号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$data.username}" placeholder="" id="username"
                       name="username">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$data.phone}" name="phone" id="phone">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>注册时间：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" disabled="disabled"
                       value="{$data.create_time}" name="create_time" id="create_time">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>状态：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input name="status" value=1 type="radio" id="sex-1" {if condition="$data.status==1" }checked{/if}>
                    <label for="sex-1">正式</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="sex-2" value=0 name="status" {if condition="$data.status==0" }checked{/if}>
                    <label for="sex-2">游客</label>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>是否锁定：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input name="lock" type="radio" value=0 {if condition="$data.lock==0" }checked{/if}>
                    <label for="sex-1">否</label>
                </div>
                <div class="radio-box">
                    <input type="radio" value=1 name="lock" {if condition="$data.lock==1" }checked{/if}>
                    <label for="sex-2">是</label>
                </div>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button class="btn btn-primary radius" id="button" type="button" value="&nbsp;&nbsp;修改&nbsp;&nbsp;">修改</button>
            </div>
        </div>
    </form>
</article>

{include file="common:footer" /}

<script type="text/javascript">
    $('#button').click(function () {
        var formData  = $('.form-agent-edittt').serialize();
        $.ajax({
            url:"{:url('agent/editSaves')}",
            type:'post',
            dataType:'json',
            data:formData,
            success:function (res) {
                if(res.code === 0 ){
                    //失败
                    layer.msg(res.msg,{icon:2},300);
                    var index = parent.layer.getFrameIndex(window.name);
                    setTimeout(function(){
                        parent.location.reload(); //刷新父级页面
                        parent.layer.close(index);//关闭弹出层
                    }, 2000);
                }else{
                    //成功
                    layer.msg(res.msg,{icon:1},300);
                    var index1 = parent.layer.getFrameIndex(window.name);
                    setTimeout(function(){
                        parent.location.reload();
                        parent.layer.close(index1);//关闭弹出层
                    }, 2000);
                }
            }
        })
    })
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>